﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using MixScriptWeb.control;
using MixScriptWeb.Share;
using MixScript.BLL;
using MixScriptWeb.AppCode.gjips;
using MixScript.BLL.WM;
using MixScript.BLL.MM;
using MixScript.BLL.SD;

using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;

namespace MixScriptWeb.Share
{
    public partial class rptPreview : System.Web.UI.Page
    {

        private static DataTable dt;
        private static DataTable dtc;
        private static string documentid = "";
        private static int doctype = 0;
        private int iprint = 0;

        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {


                ReportDocument rd = new ReportDocument();

                //  to="~/Share/rptPreview.aspx?rptid=$1&amp;sgrnid=$2&amp;suppid=$3"
                int caseSwitch = 0;
                int.TryParse(Request.QueryString["rptid"], out caseSwitch);

                string sControl = hdPrint.Value;


                #region reporttype

                switch (caseSwitch)
                {
                    case 1: //Delivery Note                       
                        #region Report Delivery Note

                        rd.Load(Server.MapPath("../report/CrystalReport1.rpt"));
                        rd.FileName = Server.MapPath("../report/CrystalReport1.rpt");
                        dt = new DataTable();
                        cDN odn = new cDN();
                        string sdntype = odn.getTipeDNbyDelno(Request.QueryString["dnno"]);//dt.Rows[0]["dntyp"].ToString(); //Session["dntype"].ToString();
                        dt = odn.getDNWithType(sdntype, Request.QueryString["dnno"]);

                        rd.SetDataSource(dt);
                        rd.SetParameterValue("dnNo", Request.QueryString["dnno"]);
                        if (sdntype.ToUpper().Trim() == "L")
                        {
                            rd.SetParameterValue("partno", "Part Name");
                        }
                        else
                        {
                            rd.SetParameterValue("partno", "Description");
                        }
                        //rd.SetParameterValue("partno", );
                        rd.SetParameterValue("snp", odn.getSNP(Request.QueryString["dnno"]));
                        rd.SetParameterValue("dnDATE", DateTime.Now.ToString("MMM. dd, yyyy"));
                        rd.SetParameterValue("P.O. No.", "");
                        rd.SetParameterValue("ppchead", "PPC HEAD");

                        #endregion
                        break;
                    case 2: //PO type 1
                        #region Report PO Type 1
                        //Console.WriteLine("Case 2");
                        rd.Load(Server.MapPath("../report/rptPO1.rpt"));
                        rd.FileName = Server.MapPath("../report/rptPO1.rpt");
                        string spono = Request.QueryString["spono"];
                        string supp = Request.QueryString["suppid"];
                        dt = new DataTable();
                        DataTable dtparam = new DataTable();
                        DataTable dtsup = new DataTable();

                        //dt = (DataTable)Session["datareport"];
                        //if (dt == null)
                        //{
                        cPO oPO = new cPO();
                        cSupplier osup = new cSupplier();
                        //dt = oPO.getDeliveryNotePrint(Request.QueryString["dnno"]);
                        oPO.getMasterpo(ref dtparam, spono);
                        osup.getSupp(supp, ref dtsup);
                        oPO.getporeport(ref dt, spono);

                        //}

                        rd.SetDataSource(dt);
                        rd.SetParameterValue("pnama", dtsup.Rows[0]["bpidnm"]);
                        rd.SetParameterValue("palamat", dtsup.Rows[0]["ad1"] + " " + dtsup.Rows[0]["ad2"]);
                        rd.SetParameterValue("ptlp", dtsup.Rows[0]["tlno"]);
                        rd.SetParameterValue("pfax", dtsup.Rows[0]["fxno"]);
                        rd.SetParameterValue("pattn", dtparam.Rows[0]["attn"]);
                        rd.SetParameterValue("pcc", dtparam.Rows[0]["cc"]);
                        rd.SetParameterValue("ptot", dtparam.Rows[0]["totamnt"]);
                        rd.SetParameterValue("psubtot", dtparam.Rows[0]["subtot"]);
                        rd.SetParameterValue("pvat", dtparam.Rows[0]["vat"]);
                        rd.SetParameterValue("podt", ((DateTime)dtparam.Rows[0]["podt"]).ToString("dd-MMM-yyyy"));

                        #endregion
                        break;
                    case 3:
                        #region Report PO TYPE 2
                        rd.Load(Server.MapPath("../report/rptPO2.rpt"));
                        rd.FileName = Server.MapPath("../report/rptPO2.rpt");
                        string spono2 = Request.QueryString["spono"];
                        string supp2 = Request.QueryString["suppid"];
                        dt = new DataTable();
                        DataTable dtparam2 = new DataTable();
                        DataTable dtsup2 = new DataTable();

                        //dt = (DataTable)Session["datareport"];
                        //if (dt == null)
                        //{
                        cPO oPO2 = new cPO();
                        cSupplier osup2 = new cSupplier();
                        //dt = oPO.getDeliveryNotePrint(Request.QueryString["dnno"]);
                        oPO2.getMasterpo(ref dtparam2, spono2);
                        osup2.getSupp(supp2, ref dtsup2);
                        oPO2.getporeport(ref dt, spono2);

                        //}

                        rd.SetDataSource(dt);
                        rd.SetParameterValue("pnama", dtsup2.Rows[0]["bpidnm"]);
                        rd.SetParameterValue("palamat", dtsup2.Rows[0]["ad1"] + " " + dtsup2.Rows[0]["ad2"]);
                        rd.SetParameterValue("ptlp", dtsup2.Rows[0]["tlno"]);
                        rd.SetParameterValue("pfax", dtsup2.Rows[0]["fxno"]);
                        rd.SetParameterValue("pattn", dtparam2.Rows[0]["attn"]);
                        rd.SetParameterValue("pcc", dtparam2.Rows[0]["cc"]);
                        rd.SetParameterValue("ptot", dtparam2.Rows[0]["totamnt"]);
                        rd.SetParameterValue("psubtot", dtparam2.Rows[0]["subtot"]);
                        rd.SetParameterValue("pvat", dtparam2.Rows[0]["vat"]);
                        rd.SetParameterValue("podt", ((DateTime)dtparam2.Rows[0]["podt"]).ToString("dd-MM-yyyy"));

                        #endregion
                        break;
                    case 4:
                        #region Report PO Type 3
                        rd.Load(Server.MapPath("../report/rptPO3.rpt"));
                        rd.FileName = Server.MapPath("../report/rptPO3.rpt");
                        string spono3 = Request.QueryString["spono"];
                        string supp3 = Request.QueryString["suppid"];
                        dt = new DataTable();
                        DataTable dtparam3 = new DataTable();
                        DataTable dtsup3 = new DataTable();

                        //dt = (DataTable)Session["datareport"];
                        //if (dt == null)
                        //{
                        cPO oPO3 = new cPO();
                        cSupplier osup3 = new cSupplier();
                        //dt = oPO.getDeliveryNotePrint(Request.QueryString["dnno"]);
                        oPO3.getMasterpo(ref dtparam3, spono3);
                        osup3.getSupp(supp3, ref dtsup3);
                        oPO3.getporeport(ref dt, spono3);

                        //}

                        rd.SetDataSource(dt);

                        rd.SetParameterValue("pnama", dtsup3.Rows[0]["bpidnm"]);
                        rd.SetParameterValue("palamat", dtsup3.Rows[0]["ad1"] + " " + dtsup3.Rows[0]["ad2"]);
                        rd.SetParameterValue("ptlp", dtsup3.Rows[0]["tlno"]);
                        rd.SetParameterValue("pfax", dtsup3.Rows[0]["fxno"]);
                        rd.SetParameterValue("pattn", dtparam3.Rows[0]["attn"]);
                        rd.SetParameterValue("pcc", dtparam3.Rows[0]["cc"]);
                        rd.SetParameterValue("ptot", dtparam3.Rows[0]["totamnt"]);
                        rd.SetParameterValue("psubtot", dtparam3.Rows[0]["subtot"]);
                        rd.SetParameterValue("pvat", dtparam3.Rows[0]["vat"]);
                        rd.SetParameterValue("podt", ((DateTime)dtparam3.Rows[0]["podt"]).ToString("dd-MM-yyyy"));
                        #endregion
                        break;
                    case 5: //Invoice
                        #region Report Invoice
                        rd.Load(Server.MapPath("../report/rptInvoice.rpt"));
                        rd.FileName = Server.MapPath("../report/rptInvoice.rpt");
                        cReferences oref = new cReferences();
                        dt = new DataTable();
                        string s = "";
                        string sinvno = Request.QueryString["sinv"];
                        oref.getInquiry(ref dt, new string[] { Session["sinv"].ToString() }, "vw_invoicereport", out s);
                        //oref.getInquiry(ref dt, new string[] {Session["sinv"].ToString() }, "tb_invmst", out s);
                        rd.SetDataSource(dt);
                        #endregion

                        break;
                    case 6: //MOF
                        #region Report MOF
                        rd.Load(Server.MapPath("../report/rptMOF.rpt"));
                        rd.FileName = Server.MapPath("../report/rptMOF.rpt");
                        cMOF omof = new cMOF();
                        dt = new DataTable();
                        //string s="";
                        string smofno = Session["smofno"].ToString();
                        omof.getInquiry(ref dt, new string[] { smofno }, "vw_mofrpt", out s);
                        //oref.getInquiry(ref dt, new string[] {Session["sinv"].ToString() }, "tb_invmst", out s);
                        rd.SetDataSource(dt);
                        rd.SetParameterValue("noform", "Jideco - 001 rev 1.0");
                        rd.SetParameterValue("compname", "PT. JIDECO INDONESIA");
                        rd.SetParameterValue("compdetail", "Kawasan Industri Kota Bukit Indah Blok D-III No.3 \n Purwakarta 41181, Jawa Barat, Indonesia");


                        #endregion
                        break;
                    case 7://GRN
                        rd.Load(Server.MapPath("../report/rptGRN.rpt"));
                        rd.FileName = Server.MapPath("../report/rptGRN.rpt");
                        cGRN oGRN = new cGRN();
                        dt = new DataTable();


                        string sGRNid = Session["sGRNID"].ToString();
                        oGRN.getInquiry5(ref dt, sGRNid, "grn_repot", out s);
                        //oGRN.getInquiry(ref dt, new string[] { sGRNid }, "vw_grnrpt", out s);                        
                        rd.SetDataSource(dt);
                        rd.SetParameterValue("cusup", Session["cusup"].ToString());
                        rd.SetParameterValue("compname", "PT. JIDECO INDONESIA");
                        rd.SetParameterValue("compdetail", "Kawasan Industri Kota Bukit Indah Blok D-III No.3 \nPurwakarta 41181, Jawa Barat, Indonesia");

                        break;


                    case 8:// List GRN
                        rd.Load(Server.MapPath("../report/rptGRNlist.rpt"));
                        rd.FileName = Server.MapPath("../report/rptGRNlist.rpt");
                        cGRN oGRN1 = new cGRN();
                        dt = new DataTable();

                        string sGRNid1 = Session["sGRNID"].ToString();
                        string supp1 = Session["supp"].ToString();
                        string sawal = Session["sawal"].ToString() + "";
                        string sakhir = Session["sakhir"].ToString();
                        oGRN1.getInquiry1(ref dt, sGRNid1, supp1, sawal, sakhir, "List_grn_repot", out s);
                        rd.SetDataSource(dt);
                        rd.SetParameterValue("compname", "PT. JIDECO INDONESIA");
                        rd.SetParameterValue("compdetail", "Kawasan Industri Kota Bukit Indah Blok D-III No.3 \nPurwakarta 41181, Jawa Barat, Indonesia");
                        rd.SetParameterValue("cprint", oGRN1.getCountPrint(8, sGRNid1).ToString());
                        if (sControl == "NGEPRINT")
                        {
                            oGRN1.incCountPrint(8, sGRNid1);
                            hdPrint.Value = "";
                        }

                        break;





                    case 9: //MOF
                        rd.Load(Server.MapPath("../report/rptMOFlist.rpt"));
                        rd.FileName = Server.MapPath("../report/rptMOFlist.rpt");
                        cMOF omof1 = new cMOF();
                        dt = new DataTable();
                        string smofno1 = Session["smofno"].ToString();
                        string sawalm = Session["sawalm"].ToString();
                        string sakhirm = Session["sakhirm"].ToString();
                        omof1.getInquiry2(ref dt, smofno1, sawalm, sakhirm, "vw_mofrpt", out s);

                        rd.SetDataSource(dt);
                        //rd.SetParameterValue("noform", "Jideco - 001 rev 1.0");
                        rd.SetParameterValue("compname", "PT. JIDECO INDONESIA");
                        rd.SetParameterValue("compdetail", "Kawasan Industri Kota Bukit Indah Blok D-III No.3 \nPurwakarta 41181, Jawa Barat, Indonesia");


                        break;

                    case 10: //inv
                        rd.Load(Server.MapPath("../report/rptMatStok.rpt"));
                        rd.FileName = Server.MapPath("../report/rptMatStok.rpt");
                        cMOF omof2 = new cMOF();
                        dt = new DataTable();
                        int bln = Convert.ToInt16(Session["ddlMonth"]);
                        int thn = Convert.ToInt16(Session["ddlTahun"]);
                        string wrhcode = Session["txtwrhcode"].ToString();
                        omof2.getInquiry3(ref dt, wrhcode, bln, thn, "dbo.MAT_Stok_Price", out s);

                        rd.SetDataSource(dt);
                        //rd.SetParameterValue("noform", "Jideco - 001 rev 1.0");
                        rd.SetParameterValue("compname", "PT. JIDECO INDONESIA");
                        rd.SetParameterValue("compdetail", "Kawasan Industri Kota Bukit Indah Blok D-III No.3 \nPurwakarta 41181, Jawa Barat, Indonesia");
                        break;

                    case 11://incoming list
                        rd.Load(Server.MapPath("../report/rptGRN.rpt"));
                        rd.FileName = Server.MapPath("../report/rptGRN.rpt");
                        cGRN oGRNo = new cGRN();
                        dt = new DataTable();

                        string sGRNo = Request.QueryString["grnno"].Replace("@", "-");

                        oGRNo.getInquiry5(ref dt, sGRNo.Replace("qwerty", "/"), "grn_repot", out s);

                        rd.SetDataSource(dt);

                        //rd.SetParameterValue("noform", "Jideco - 001 rev 1.0");
                        rd.SetParameterValue("cusup", Session["cusup"].ToString());
                        rd.SetParameterValue("compname", "PT. JIDECO INDONESIA");
                        rd.SetParameterValue("compdetail", "Kawasan Industri Kota Bukit Indah Blok D-III No.3 \nPurwakarta 41181, Jawa Barat, Indonesia");
                        break;
                    case 12://outgoing list
                        rd.Load(Server.MapPath("../report/rptMOF.rpt"));
                        rd.FileName = Server.MapPath("../report/rptMOF.rpt");
                        cMOF oMOFo = new cMOF();
                        dt = new DataTable();


                        string mofNo = Request.QueryString["mofno"].Replace("@", "-");

                        oMOFo.getInquiry(ref dt, new string[] { mofNo.Replace("qwerty", "/") }, "vw_mofrpt", out s);
                        //oref.getInquiry(ref dt, new string[] {Session["sinv"].ToString() }, "tb_invmst", out s);
                        rd.SetDataSource(dt);
                        rd.SetParameterValue("noform", "Jideco - 001 rev 1.0");
                        rd.SetParameterValue("compname", "PT. JIDECO INDONESIA");
                        rd.SetParameterValue("compdetail", "Kawasan Industri Kota Bukit Indah Blok D-III No.3 \nPurwakarta 41181, Jawa Barat, Indonesia");

                        break;

                    case 13:
                        rd.Load(Server.MapPath("../report/StokCard.rpt"));
                        rd.FileName = Server.MapPath("../report/StokCard.rpt");
                        cMOF oMOFo1 = new cMOF();
                        dt = new DataTable();


                        string matid = Request.QueryString["smatid"];
                        string wrhid = Request.QueryString["wrhid"];
                        int bl = Convert.ToInt16(Request.QueryString["bln"].ToString());
                        int tahun = Convert.ToInt16(Request.QueryString["tahun"].ToString());


                        oMOFo1.getInquiry4(ref dt, matid, wrhid, bl, tahun, "Stok_Card", out s);

                        rd.SetDataSource(dt);
                        //rd.SetParameterValue("noform", "Jideco - 001 rev 1.0");
                        rd.SetParameterValue("compname", "PT. JIDECO INDONESIA");
                        rd.SetParameterValue("compdetail", "Kawasan Industri Kota Bukit Indah Blok D-III No.3 \nPurwakarta 41181, Jawa Barat, Indonesia");

                        break;
                    case 14://Sales order
                        rd.Load(Server.MapPath("../report/So.rpt"));
                        rd.FileName = Server.MapPath("../report/So.rpt");
                        cSalesOrder oMOFo12 = new cSalesOrder();
                        dt = new DataTable();


                        string so = Request.QueryString["so"];
                        string cus = Request.QueryString["cus"];
                        string tgl1 = Request.QueryString["t1"];
                        string tgl2 = Request.QueryString["t2"];


                        oMOFo12.getInquiryS(ref dt, so, cus, tgl1.Replace("@", "-"), tgl2.Replace("@", "-"), "Stok_Card", out s);

                        rd.SetDataSource(dt);
                        //rd.SetParameterValue("noform", "Jideco - 001 rev 1.0");
                        rd.SetParameterValue("compname", "PT. JIDECO INDONESIA");
                        rd.SetParameterValue("compdetail", "Kawasan Industri Kota Bukit Indah Blok D-III No.3 \nPurwakarta 41181, Jawa Barat, Indonesia");

                        break;
                    case 15://Packing list
                        rd.Load(Server.MapPath("../report/pack.rpt"));
                        rd.FileName = Server.MapPath("../report/pack.rpt");
                        cPacking oMOFo123 = new cPacking();
                        dt = new DataTable();


                        string sop = Request.QueryString["so"];
                        string cusp = Request.QueryString["cus"];
                        string tgl11 = Request.QueryString["t1"];
                        string tgl22 = Request.QueryString["t2"];


                        oMOFo123.getInquirya(ref dt, sop, tgl11.Replace("@", "-"), tgl22.Replace("@", "-"), "Stok_Card", out s);

                        rd.SetDataSource(dt);
                        rd.SetParameterValue("compname", "PT. JIDECO INDONESIA");
                        rd.SetParameterValue("compdetail", "Kawasan Industri Kota Bukit Indah Blok D-III No.3 \nPurwakarta 41181, Jawa Barat, Indonesia");

                        break;
                    case 16://Sales Return list
                        rd.Load(Server.MapPath("../report/salret.rpt"));
                        rd.FileName = Server.MapPath("../report/salret.rpt");

                        cSalesOrder oMOFo1234 = new cSalesOrder();
                        dt = new DataTable();


                        string sor = Request.QueryString["so"];
                        string cust = Request.QueryString["cus"];
                        string tglor1 = Request.QueryString["t1"];
                        string tglor2 = Request.QueryString["t2"];



                        oMOFo1234.getInquiryR(ref dt, sor, cust, tglor1.Replace("@", "-"), tglor2.Replace("@", "-"), "Stok_Card", out s);
                        rd.SetDatabaseLogon(System.Configuration.ConfigurationManager.AppSettings["userdb"].ToString(), System.Configuration.ConfigurationManager.AppSettings["passdb"].ToString());
                        rd.SetDataSource(dt);
                        rd.SetParameterValue("compname", "PT. JIDECO INDONESIA");
                        rd.SetParameterValue("compdetail", "Kawasan Industri Kota Bukit Indah Blok D-III No.3 \nPurwakarta 41181, Jawa Barat, Indonesia");

                        break;
                    case 17://Invoice list
                        rd.Load(Server.MapPath("../report/List_rptInvoice.rpt"));
                        rd.FileName = Server.MapPath("../report/List_rptInvoice.rpt");

                        cInvoice inv = new cInvoice();
                        dt = new DataTable();


                        string invno = Request.QueryString["so"];
                        string custno = Request.QueryString["cus"];
                        string tglin1 = Request.QueryString["t1"];
                        string tglin2 = Request.QueryString["t2"];



                        inv.getInquiry(ref dt, invno, custno, tglin1.Replace("@", "-"), tglin2.Replace("@", "-"), "vw_invoicereport", out s);
                        rd.SetDatabaseLogon(System.Configuration.ConfigurationManager.AppSettings["userdb"].ToString(), System.Configuration.ConfigurationManager.AppSettings["passdb"].ToString());
                        rd.SetDataSource(dt);
                        rd.SetParameterValue("compname", "PT. JIDECO INDONESIA");
                        rd.SetParameterValue("compdetail", "Kawasan Industri Kota Bukit Indah Blok D-III No.3 \nPurwakarta 41181, Jawa Barat, Indonesia");

                        break;

                    case 19://oUSTANDING po
                        rd.Load(Server.MapPath("../report/PO_OUSTANDING.rpt"));
                        rd.FileName = Server.MapPath("../report/PO_OUSTANDING.rpt");

                        cPO pOk = new cPO();
                        dt = new DataTable();


                        pOk.getOutstanding(ref dt, Session["POawal"].ToString(), Session["POakhir"].ToString(), "vw_po_outstanding", out s);
                        rd.SetDataSource(dt);
                        rd.SetParameterValue("compname", "PT. JIDECO INDONESIA");
                        rd.SetParameterValue("periode", "Periode : " + Session["POawal"].ToString().Substring(0, 10) + " up to " + Session["POakhir"].ToString().Substring(0, 10));


                        break;
                    case 20://oUSTANDING so
                        rd.Load(Server.MapPath("../report/sO_OUSTANDING.rpt"));
                        rd.FileName = Server.MapPath("../report/sO_OUSTANDING.rpt");

                        cSalesOrder SOk = new cSalesOrder();
                        dt = new DataTable();


                        SOk.getOutstandingSO(ref dt, Session["SOawal"].ToString(), Session["SOakhir"].ToString(), "VW_SO_outstanding", out s);
                        rd.SetDataSource(dt);
                        rd.SetParameterValue("compname", "PT. JIDECO INDONESIA");
                        rd.SetParameterValue("periode", "Periode : " + Session["SOawal"].ToString().Substring(0, 10) + " up to " + Session["SOakhir"].ToString().Substring(0, 10));

                        break;
                    case 21://aging payable
                        rd.Load(Server.MapPath("../report/agingPay.rpt"));
                        rd.FileName = Server.MapPath("../report/agingPay.rpt");

                        cPO pay = new cPO();
                        dt = new DataTable();
                        pay.getpay(ref dt, Session["paramxx"].ToString(), Session["tglxx"].ToString(), "", "aging_payabled", out s);
                        rd.SetDataSource(dt);
                        rd.SetParameterValue("tgl", "As Of Date : " + Session["tglxx"].ToString());

                        break;

                    case 22://aging receiveable
                        rd.Load(Server.MapPath("../report/agingrec.rpt"));
                        rd.FileName = Server.MapPath("../report/agingrec.rpt");

                        cPO rec = new cPO();
                        dt = new DataTable();
                        rec.getpay(ref dt, Session["paramrec"].ToString(), Session["tglrec"].ToString(), "", "aging_received", out s);
                        rd.SetDataSource(dt);
                        rd.SetParameterValue("tgl", "As Of Date : " + Session["tglrec"].ToString());

                        break;
                    case 23://Card payable
                        rd.Load(Server.MapPath("../report/Paycard.rpt"));
                        rd.FileName = Server.MapPath("../report/Paycard.rpt");

                        cPO paycar = new cPO();
                        dt = new DataTable();
                        paycar.getpay(ref dt, Session["paycard"].ToString(), Session["tglcard1"].ToString(), Session["tglcard2"].ToString(), "Pay_Card", out s);
                        rd.SetDataSource(dt);
                        rd.SetParameterValue("tgl", "Period : " + Session["tglcard1"].ToString().Substring(0, 10) + " Up to " + Session["tglcard2"].ToString().Substring(0, 10));

                        break;

                    case 24://Card Rec
                        rd.Load(Server.MapPath("../report/reccard.rpt"));
                        rd.FileName = Server.MapPath("../report/reccard.rpt");

                        cPO reccar = new cPO();
                        dt = new DataTable();
                        reccar.getpay(ref dt, Session["reccard"].ToString(), Session["tglrcard1"].ToString(), Session["tglrcard2"].ToString(), "rec_Card", out s);
                        rd.SetDataSource(dt);
                        rd.SetParameterValue("tgl", "Period : " + Session["tglrcard1"].ToString().Substring(0, 10) + " Up to " + Session["tglrcard2"].ToString().Substring(0, 10));

                        break;

                    case 25://Card Rec
                        rd.Load(Server.MapPath("../report/RecDetail.rpt"));
                        rd.FileName = Server.MapPath("../report/RecDetail.rpt");

                        cPO reccardetaill = new cPO();
                        dt = new DataTable();
                        reccardetaill.getdetailRec(ref dt, Session["ddlMonthrecdetail"].ToString(),
                        Session["ddlTahunrecdetail"].ToString(), "", "rec_detail", out s);
                        rd.SetDataSource(dt);
                        // rd.SetParameterValue("tgl", "Period : " +Session["tglrcard1"].ToString().Substring(0, 10) + " Up to " +Session["tglrcard2"].ToString().Substring(0, 10));

                        break;
                    case 26://Card Rec
                        rd.Load(Server.MapPath("../report/payDetail.rpt"));
                        rd.FileName = Server.MapPath("../report/payDetail.rpt");

                        cPO paycardetaill = new cPO();
                        dt = new DataTable();
                        paycardetaill.getdetailRec(ref dt, Session["ddlMonthpaydetail"].ToString(), Session["ddlTahunpaydetail"].ToString(), "", "pay_detail", out s);
                        rd.SetDataSource(dt);
                        // rd.SetParameterValue("tgl", "6Period : " +Session["tglrcard1"].ToString().Substring(0, 10) + " Up to " +Session["tglrcard2"].ToString().Substring(0, 10));

                        break;



                    //case 26://incoming list
                    //    rd.Load(Server.MapPath("../report/rptGRNFG.rpt"));
                    //    rd.FileName = Server.MapPath("../report/rptGRNFG.rpt");
                    //    cGRN oGRNoFG = new cGRN();
                    //    dt = new DataTable();


                    //    string sGRNoFG = Request.QueryString["grnno"].Replace("@", "-");

                    //    oGRNoFG.getInquiry5(ref dt, sGRNoFG.Replace("qwerty", "/"), "grn_repot", out s);

                    //    rd.SetDataSource(dt);
                    //    //rd.SetParameterValue("noform", "Jideco - 001 rev 1.0");
                    //    rd.SetParameterValue("compname", "PT. JIDECO INDONESIA");
                    //    rd.SetParameterValue("compdetail", "Kawasan Industri Kota Bukit Indah Blok D-III No.3 \nPurwakarta 41181, Jawa Barat, Indonesia");
                    //    break;
                    default:
                        lblmsg.Text = "Invalid Report ID";
                        break;
                }

                #endregion

                hdPrint.Value = "";

                //if (((System.Web.Configuration.HttpCapabilitiesBase)(Request.Browser)).Browser == "IE")
                //{
                //}

                CrystalReportViewer1.ReportSource = rd;



            }
            catch (Exception ex)
            {

                lblmsg.Text = ex.Message;
            }

        }

        protected void CrystalReportViewer1_Load(object sender, EventArgs e)
        {

        }

    }
}